Free desktop tools and utilities for Windows. Download our software now.Free desktop tools and utilities for Windows. Download our software now.
HomeContact us
free windows software utility
free windows software tools

Hardware IDExtractor
Hardware serial number extractor library

free software

Main page

 

Hardware IDExtractor complete demo - Source code

 

Download the free source code of the Hardware ID Extractor demo application v2 (see GUI screenshot below). Tested under Delphi XE.

 

hardware id extractor

 

 

UNIT MainForm;

 

CONST
  MemoryLoad    = 1;                                                         { Total memory used in percents (%)   }
  TotalPhys     = 2;                                                         { Total physical memory in bytes      }
  AvailPhys     = 3;                                                         { Available physical memory (bytes)   }
  TotalPageFile = 4;                                                         { Total page file in (bytes)                  }
  AvailPageFile = 5;                                                         { Available page file (bytes)                 }
  TotalVirtual  = 6;                                                         { Total virtual memory in bytes       }
  AvailVirtual  = 7;                                                         { Available virtual memory (bytes)    }

  CPU_Core1     = 2;                                                         { binary mask for CORE 1              }
  CPU_Core2     = 1;                                                         { binary mask for CORE 2              }

 

 

{ FUNCTIONS IMPORTED FROM DLL: }

function GetCPUSpeed: Double;                      stdcall; external 'HardwareIDExtractor.DLL';
function CPUFamily  : ShortString;                 stdcall; external 'HardwareIDExtractor.DLL';    { Get cpu identifier }
function GetCpuTheoreticSpeed: Integer;            stdcall; external 'HardwareIDExtractor.DLL';    { Get cpu speed (in MHz) }
function IsCPUIDAvailable: Boolean;                stdcall; external 'HardwareIDExtractor.DLL';
function GetCPUID (CpuCore: byte): ShortString;    stdcall; external 'HardwareIDExtractor.DLL';
Function GetCPUVendor: ShortString;                stdcall; external 'HardwareIDExtractor.DLL';
function MemoryStatus    (MemType: Integer): cardinal; stdcall; external 'HardwareIDExtractor.DLL';   { in Bytes }
function MemoryStatus_MB (MemType: Integer): ShortString; stdcall; external 'HardwareIDExtractor.DLL';   { in MB }
function GetPartitionID  (Partition: PChar): ShortString; stdcall; external 'HardwareIDExtractor.DLL';   { Get the ID of the specified patition. Example: 'C:' }
function GetIDESerialNumber(DriveNumber: Byte ): PChar;stdcall; external 'HardwareIDExtractor.DLL';   { DriveNr is from 0 to 4 }

 

 

implementation

 

 

procedure TfrmMain.btnStartClick(Sender: TObject);
VAR sPath: PChar;
begin
 { HDD }
 lblHrdwHDD.Caption:= 'IDE disk drive ID (hardware): '+ Trim(GetIdeSerialNumber(0));
 if   lblHrdwHDD.Caption = ''                                                             { if disk 0 is invalid }
 then lblHrdwHDD.Caption:= 'IDE disk drive ID (hardware): '+ Trim(GetIdeSerialNumber(1)); { get the ID of the next drive }
 sPath:= PChar(DriveCombo.Drive + ':\');
 lblSoftID.Caption:= 'Partition ID: '+ GetPartitionID(sPath);

 

 {CPU}                                                                               
 lblCPUFamily   .Caption:= 'CPU Family: '+ CPUFamily;
 lblGetCPUVendor.Caption:= 'CPU Vendor: '+ GetCPUVendor;
 lblCPUspeed    .Caption:= 'CPU Speed: ' + FloatToStr( GetCPUSpeed )     + ' MHz (current)';


 {CPU-ID}
 lblCpuId.Caption  := 'CPU ID: '+ GetCPUID(CPU_Core1)
 
 {RAM }
 lblMemoryStatusMB.Caption:= 'RAM: '+string(ProcessPeakMem+ ' MB';           { in MB }
end;

 

end.

 

Note: This code was designed for v2 of our DLL but it should still work with v1.5.

 

 

 

free windows desktop software utility
   
Hardware ID Extractor